/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cheetah.youbet.core;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ResourceBundle;
import org.apache.commons.lang3.StringUtils;
import org.cheetah.youbet.core.BetCore;

/**
 *
 * @author edoardo
 */
public class YouBet {

    static final ResourceBundle rb = ResourceBundle.getBundle("org.cheetah.youbet.etc.youbet");

    public static void main(String[] args) throws Exception {
        String[] interfaces = StringUtils.split(rb.getString("youbet.core"), ",");

        for (String _className : interfaces) {
            BetCore betCore = (BetCore) Class.forName(_className).newInstance();
            InputStream in = null;
            try {
                in = betCore.downloadBooks();
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
            betCore.downloadScores();
            try {
                betCore.store(in);
//                betCore.store(new FileInputStream("/Users/edoardo/test.xls"));
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }

        }

    }
}
